// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial

Test := Rectangle {
    property<color> b1: blue;
    property<color> b2: #00f;
    property<color> b3: #0000ff;
    property<color> b4: #00ff;
    property<color> b5: #0000ffff;
    property<color> r1: red;
    property<color> r2: #f00;
    property<color> r3: #ff0000;
    property<color> r4: #f00f;
    property<color> r5: #ff0000ff;

    property<color> y1: yellow;
    property<color> y2: #ff0;

    property<color> g1: #999;

    property<color> c1: #ff335588;
    property<color> c2: rgb(100, 23, 42);
    property<color> c3: rgba(39%, 50%, 16%, 81%);

    property<color> i1: rgb(0, 666, -85);

    property<bool> test: b1 == b2 && b2 == b5 && b3 == Colors.blue && Colors.red == r4 && y1 == Colors.rgba(255, 100%, 0, 100%);
}

/*
```cpp
auto handle = Test::create();
const Test &t = *handle;
assert_eq(t.get_r1(), t.get_r2());
assert_eq(t.get_r1(), t.get_r3());
assert_eq(t.get_r1(), t.get_r4());
assert_eq(t.get_r1(), t.get_r5());
assert_eq(t.get_b1(), t.get_b2());
assert_eq(t.get_b1(), t.get_b3());
assert_eq(t.get_b1(), t.get_b4());
assert_eq(t.get_b1(), t.get_b5());
assert(t.get_b1() != t.get_r5());
assert_eq(t.get_y1(), t.get_y2());

auto red = slint::Color::from_argb_float(1, 1, 0, 0);
auto blue = slint::Color::from_rgb_float(0, 0, 1);
auto g = slint::Color::from_rgb_uint8(0x99, 0x99, 0x99);
assert_eq(t.get_r1(), red);
assert_eq(t.get_b1(), blue);
assert_eq(t.get_g1(), g);
assert_eq(t.get_y1(), slint::Color::from_argb_encoded(0xffffff00));

t.set_g1(blue);
assert_eq(t.get_g1(), t.get_b1());

assert_eq(t.get_c1().alpha(), 0x88);
assert_eq(t.get_c1().red(), 0xff);
assert_eq(t.get_c1().green(), 0x33);
assert_eq(t.get_c1().blue(), 0x55);

assert_eq(t.get_c2().alpha(), 0xff);
assert_eq(t.get_c2().red(), 100);
assert_eq(t.get_c2().green(), 23);
assert_eq(t.get_c2().blue(), 42);

assert_eq(t.get_c3().alpha(), uint8_t(255.*0.81));
assert_eq(t.get_c3().red(), uint8_t(255.*0.39));
assert_eq(t.get_c3().green(), uint8_t(255.*0.50));
assert_eq(t.get_c3().blue(), uint8_t(255.*0.16));

assert_eq(t.get_i1().alpha(), 0xff);
assert_eq(t.get_i1().red(), 0);
assert_eq(t.get_i1().green(), 255);
assert_eq(t.get_i1().blue(), 0);
```


```rust
let t = Test::new().unwrap();
assert_eq!(t.get_r1(), t.get_r2());
assert_eq!(t.get_r1(), t.get_r3());
assert_eq!(t.get_r1(), t.get_r4());
assert_eq!(t.get_r1(), t.get_r5());
assert_eq!(t.get_b1(), t.get_b2());
assert_eq!(t.get_b1(), t.get_b3());
assert_eq!(t.get_b1(), t.get_b4());
assert_eq!(t.get_b1(), t.get_b5());
assert_ne!(t.get_b1(), t.get_r5());
assert_eq!(t.get_y1(), t.get_y2());

let red = slint::Color::from_argb_f32(1., 1., 0., 0.);
let blue = slint::Color::from_rgb_f32(0., 0., 1.);
let g = slint::Color::from_rgb_u8(0x99, 0x99, 0x99);
assert_eq!(t.get_r1(), red);
assert_eq!(t.get_b1(), blue);
assert_eq!(t.get_g1(), g);
assert_eq!(t.get_y1(), slint::Color::from_argb_encoded(0xffffff00));

t.set_g1(blue);
assert_eq!(t.get_g1(), t.get_b1());

assert_eq!(t.get_c1().alpha(), 0x88);
assert_eq!(t.get_c1().red(), 0xff);
assert_eq!(t.get_c1().green(), 0x33);
assert_eq!(t.get_c1().blue(), 0x55);

assert_eq!(t.get_c2().alpha(), 0xff);
assert_eq!(t.get_c2().red(), 100);
assert_eq!(t.get_c2().green(), 23);
assert_eq!(t.get_c2().blue(), 42);

assert_eq!(t.get_c3().alpha(), (255.*0.81) as u8);
assert_eq!(t.get_c3().red(), (255.*0.39) as u8);
assert_eq!(t.get_c3().green(), (255.*0.50) as u8);
assert_eq!(t.get_c3().blue(), (255.*0.16) as u8);

assert_eq!(t.get_i1().alpha(), 0xff);
assert_eq!(t.get_i1().red(), 0);
assert_eq!(t.get_i1().green(), 255);
assert_eq!(t.get_i1().blue(), 0);

```

```js
var t = new slint.Test({});
assert(t.r1 == t.r2);
assert(t.r1 == t.r3);
assert(t.r1 == t.r4);
assert(t.r1 == t.r5);
assert(t.b1 == t.b2);
assert(t.b1 == t.b3);
assert(t.b1 == t.b4);
assert(t.b1 == t.b5);
assert(t.b1 != t.r5);

let red = "#ff0000ff";
let blue = "#0000ffff";
let g = "#999999ff";
assert.equal(t.r1, red);
assert.equal(t.b1, blue);
assert.equal(t.g1, g);
assert.equal(t.y1, "#ffff00ff");

t.g1 = "blue";
assert.equal(t.g1, t.b1);
t.g1 = "#f00";
assert.equal(t.g1, t.r1);

assert.equal(t.c1, "#ff335588");
assert.equal(t.c2, "#64172aff");
assert.equal(t.c3, "#637f28ce");
assert.equal(t.i1, "#00ff00ff");

```
*/
